/**
 */
package de.fhdw.seminar.xtext.umlDsl.impl;

import de.fhdw.seminar.xtext.umlDsl.BuiltInTypes;
import de.fhdw.seminar.xtext.umlDsl.UmlAssociation;
import de.fhdw.seminar.xtext.umlDsl.UmlAttribute;
import de.fhdw.seminar.xtext.umlDsl.UmlClass;
import de.fhdw.seminar.xtext.umlDsl.UmlDslFactory;
import de.fhdw.seminar.xtext.umlDsl.UmlDslPackage;
import de.fhdw.seminar.xtext.umlDsl.UmlModel;

import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EEnum;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.EReference;

import org.eclipse.emf.ecore.impl.EPackageImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model <b>Package</b>.
 * <!-- end-user-doc -->
 * @generated
 */
public class UmlDslPackageImpl extends EPackageImpl implements UmlDslPackage
{
  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass umlModelEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass umlClassEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass umlAssociationEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EClass umlAttributeEClass = null;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private EEnum builtInTypesEEnum = null;

  /**
   * Creates an instance of the model <b>Package</b>, registered with
   * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
   * package URI value.
   * <p>Note: the correct way to create the package is via the static
   * factory method {@link #init init()}, which also performs
   * initialization of the package, or returns the registered package,
   * if one already exists.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see org.eclipse.emf.ecore.EPackage.Registry
   * @see de.fhdw.seminar.xtext.umlDsl.UmlDslPackage#eNS_URI
   * @see #init()
   * @generated
   */
  private UmlDslPackageImpl()
  {
    super(eNS_URI, UmlDslFactory.eINSTANCE);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private static boolean isInited = false;

  /**
   * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
   * 
   * <p>This method is used to initialize {@link UmlDslPackage#eINSTANCE} when that field is accessed.
   * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #eNS_URI
   * @see #createPackageContents()
   * @see #initializePackageContents()
   * @generated
   */
  public static UmlDslPackage init()
  {
    if (isInited) return (UmlDslPackage)EPackage.Registry.INSTANCE.getEPackage(UmlDslPackage.eNS_URI);

    // Obtain or create and register package
    UmlDslPackageImpl theUmlDslPackage = (UmlDslPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof UmlDslPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new UmlDslPackageImpl());

    isInited = true;

    // Create package meta-data objects
    theUmlDslPackage.createPackageContents();

    // Initialize created meta-data
    theUmlDslPackage.initializePackageContents();

    // Mark meta-data to indicate it can't be changed
    theUmlDslPackage.freeze();

  
    // Update the registry and return the package
    EPackage.Registry.INSTANCE.put(UmlDslPackage.eNS_URI, theUmlDslPackage);
    return theUmlDslPackage;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getUmlModel()
  {
    return umlModelEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getUmlModel_Classes()
  {
    return (EReference)umlModelEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getUmlClass()
  {
    return umlClassEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getUmlClass_IsAbstract()
  {
    return (EAttribute)umlClassEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getUmlClass_Name()
  {
    return (EAttribute)umlClassEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getUmlClass_SuperType()
  {
    return (EReference)umlClassEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getUmlClass_Associations()
  {
    return (EReference)umlClassEClass.getEStructuralFeatures().get(3);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getUmlClass_Attributes()
  {
    return (EReference)umlClassEClass.getEStructuralFeatures().get(4);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getUmlAssociation()
  {
    return umlAssociationEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getUmlAssociation_Name()
  {
    return (EAttribute)umlAssociationEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EReference getUmlAssociation_Type()
  {
    return (EReference)umlAssociationEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getUmlAssociation_IsMany()
  {
    return (EAttribute)umlAssociationEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EClass getUmlAttribute()
  {
    return umlAttributeEClass;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getUmlAttribute_Name()
  {
    return (EAttribute)umlAttributeEClass.getEStructuralFeatures().get(0);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getUmlAttribute_Type()
  {
    return (EAttribute)umlAttributeEClass.getEStructuralFeatures().get(1);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EAttribute getUmlAttribute_IsMany()
  {
    return (EAttribute)umlAttributeEClass.getEStructuralFeatures().get(2);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public EEnum getBuiltInTypes()
  {
    return builtInTypesEEnum;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public UmlDslFactory getUmlDslFactory()
  {
    return (UmlDslFactory)getEFactoryInstance();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isCreated = false;

  /**
   * Creates the meta-model objects for the package.  This method is
   * guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void createPackageContents()
  {
    if (isCreated) return;
    isCreated = true;

    // Create classes and their features
    umlModelEClass = createEClass(UML_MODEL);
    createEReference(umlModelEClass, UML_MODEL__CLASSES);

    umlClassEClass = createEClass(UML_CLASS);
    createEAttribute(umlClassEClass, UML_CLASS__IS_ABSTRACT);
    createEAttribute(umlClassEClass, UML_CLASS__NAME);
    createEReference(umlClassEClass, UML_CLASS__SUPER_TYPE);
    createEReference(umlClassEClass, UML_CLASS__ASSOCIATIONS);
    createEReference(umlClassEClass, UML_CLASS__ATTRIBUTES);

    umlAssociationEClass = createEClass(UML_ASSOCIATION);
    createEAttribute(umlAssociationEClass, UML_ASSOCIATION__NAME);
    createEReference(umlAssociationEClass, UML_ASSOCIATION__TYPE);
    createEAttribute(umlAssociationEClass, UML_ASSOCIATION__IS_MANY);

    umlAttributeEClass = createEClass(UML_ATTRIBUTE);
    createEAttribute(umlAttributeEClass, UML_ATTRIBUTE__NAME);
    createEAttribute(umlAttributeEClass, UML_ATTRIBUTE__TYPE);
    createEAttribute(umlAttributeEClass, UML_ATTRIBUTE__IS_MANY);

    // Create enums
    builtInTypesEEnum = createEEnum(BUILT_IN_TYPES);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  private boolean isInitialized = false;

  /**
   * Complete the initialization of the package and its meta-model.  This
   * method is guarded to have no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void initializePackageContents()
  {
    if (isInitialized) return;
    isInitialized = true;

    // Initialize package
    setName(eNAME);
    setNsPrefix(eNS_PREFIX);
    setNsURI(eNS_URI);

    // Create type parameters

    // Set bounds for type parameters

    // Add supertypes to classes

    // Initialize classes and features; add operations and parameters
    initEClass(umlModelEClass, UmlModel.class, "UmlModel", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEReference(getUmlModel_Classes(), this.getUmlClass(), null, "classes", null, 0, -1, UmlModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(umlClassEClass, UmlClass.class, "UmlClass", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getUmlClass_IsAbstract(), ecorePackage.getEBoolean(), "isAbstract", null, 0, 1, UmlClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getUmlClass_Name(), ecorePackage.getEString(), "name", null, 0, 1, UmlClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getUmlClass_SuperType(), this.getUmlClass(), null, "superType", null, 0, 1, UmlClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getUmlClass_Associations(), this.getUmlAssociation(), null, "associations", null, 0, -1, UmlClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getUmlClass_Attributes(), this.getUmlAttribute(), null, "attributes", null, 0, -1, UmlClass.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(umlAssociationEClass, UmlAssociation.class, "UmlAssociation", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getUmlAssociation_Name(), ecorePackage.getEString(), "name", null, 0, 1, UmlAssociation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEReference(getUmlAssociation_Type(), this.getUmlClass(), null, "type", null, 0, 1, UmlAssociation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getUmlAssociation_IsMany(), ecorePackage.getEBoolean(), "isMany", null, 0, 1, UmlAssociation.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    initEClass(umlAttributeEClass, UmlAttribute.class, "UmlAttribute", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(getUmlAttribute_Name(), ecorePackage.getEString(), "name", null, 0, 1, UmlAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getUmlAttribute_Type(), this.getBuiltInTypes(), "type", null, 0, 1, UmlAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
    initEAttribute(getUmlAttribute_IsMany(), ecorePackage.getEBoolean(), "isMany", null, 0, 1, UmlAttribute.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);

    // Initialize enums and add enum literals
    initEEnum(builtInTypesEEnum, BuiltInTypes.class, "BuiltInTypes");
    addEEnumLiteral(builtInTypesEEnum, BuiltInTypes.BOOLEAN);
    addEEnumLiteral(builtInTypesEEnum, BuiltInTypes.INTEGER);
    addEEnumLiteral(builtInTypesEEnum, BuiltInTypes.STRING);

    // Create resource
    createResource(eNS_URI);
  }

} //UmlDslPackageImpl
